﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;

namespace Tron
{
    public class Player
    {
        [DataMember]
        private string name;
        [DataMember]
        private Moto moto;
        [DataMember]
        private int score; // Current score of a player (manches gagnées sur une partie)
        [DataMember]
        private int victories; // Total victories of a player
        
        public Player(string name, Moto moto)
        {
            this.name = name;
            this.moto = moto;
            this.score = 0;
            this.victories = 0;
        }

        /**
         * Teste la vicoire d'un joueur.
         * 
         * return true si victoire, false sinon. 
         */
        public Boolean victoryTest()
        {
            if (score == Constantes.scoreToWin)
            {
                this.victories++;
                return true;
            }
            else
                return false;
        }
                
        public Moto Moto
        {
            get { return moto;}  
            set { moto = value;}
        }

        public String Name
        {
            get { return name; }
            set { name = value; }
        }

        public int Score
        {
            get { return score; }
            set { score = value; }
        }

        public int Victory
        {
            get { return victories; }
            set { victories = value; }
        }
    }
}
